import { ajaxGet } from 'api/axios'
import { HttpUrl, ERR_OK } from 'api/config'

const actions = {
  GET_TOTAL ({ commit }, data) {
    return new Promise(async resolve => {
      const url = `${HttpUrl}/GmnwApi/deviceRealRecord/queryCountByDeviceStatus`

      const res = await ajaxGet(url, data)

      if (res.code === ERR_OK) {
        commit('SET_TOTAL', res.data)
        resolve(true)
      } else {
        resolve(false)
      }
    })
  }
}

export default actions
